import request from './request.js'
class getData {
    constructor() {
        this._baseUrl = 'https://www.duilusx.com/duilu/'
       // this._baseUrl = 'http://10.87.200.85/'
        this._defaultHeader = { 'Content-Type': 'application/json' }
        this._request = new request
        this._request.setErrorHandler(this.errorHander);
    }

    /**
     * 统一的异常处理方法
     */
    errorHander(res) {
        console.error(res)
    }
    index(type) {
        const params = { type: type }
        return this._request.getRequest(this._baseUrl + 'rec/index', params).then(res => res.data);
    }
    activities(params) {
        return this._request.getRequest(this._baseUrl + 'act/activities', params).then(res => res.data);
    };
    actDetail(params) {
        return this._request.getRequest(this._baseUrl + 'act/actDetail', params).then(res => res.data);
    }
    addConsult(params) {
        return this._request.postRequest(this._baseUrl + 'cons/addConsult', params).then(res => res.data);
    }
    assDetail(params) {
        return this._request.getRequest(this._baseUrl + 'act/assDetail', params).then(res => res.data);
    }
    artDetail(params) {
        return this._request.getRequest(this._baseUrl + '/art/artDetail', params).then(res => res.data);
    }
    addCollection(params) {
        return this._request.postRequest(this._baseUrl + 'col/addCollection', params).then(res => res.data);
    }
    tt_expertes(pageIndex, pageSize) {
        const params = { page_index: pageIndex, page_size: pageSize }
      return this._request.getRequest(this._baseUrl + '/tea/tt_expertes', params).then(res => res.data);
    }
    add_del_Collection(params) {
        return this._request.getRequest(this._baseUrl + '/col/add_del_Collection', params).then(res => res.data);
    }
    workShopDetail(params) {
        return this._request.postRequest(this._baseUrl + 'audio/workShopDetail', params).then(res => res.data);
    }
    recommendDatas(params) {
        return this._request.postRequest(this._baseUrl + 'ws/recommendDatas', params).then(res => res.data);
    }
    partnerByOpenId(params) {
        return this._request.postRequest(this._baseUrl + 'art/partnerByOpenId', params).then(res => res.data);
    }
    enrolls(params) {
        return this._request.postRequest(this._baseUrl + 'audio/enrolls', params).then(res => res.data);
    }
    articles(params) {
        return this._request.getRequest(this._baseUrl + 'art/articles', params).then(res => res.data);
    }
    shareAct(params) {
        return this._request.postRequest(this._baseUrl + 'act/shareAct', params).then(res => res.data);
    }
    couDetail(params) {
        return this._request.getRequest(this._baseUrl + 'cou/couDetail', params).then(res => res.data);
    }
    skipToTeaDetail(params) {
        return this._request.getRequest(this._baseUrl + 'tea/skipToTeaDetail', params).then(res => res.data);
    }
}
export default getData